function[f b w]=getbetas(param)
global NF IDV NV
if NF>0
  f=param(1:NF,1);
else
  f=[];
end

if NV>0
  if sum(IDV(:,2) == 5) >0;
     b=zeros(NV,1);
     b(IDV(:,2) ~= 5,1)=param(NF+1:NF+sum(IDV(:,2) ~= 5),1);
     w=param(NF+sum(IDV(:,2) ~= 5)+1:end,1);
  else;
     b=param(NF+1:NF+NV,1);
     w=param(NF+NV+1:NF+NV+NV,1);
  end;
else
  b=[];
  w=[];
end
